15. Solution: Strings

Here are our solutions to some quizzes on the previous page:

Solution: Fix the Quote

Here are two different methods to fix the quote:

# TODO: Fix this string!
ford_quote = 'Whether you think you can, or you think you can\'t--you\'re right.'

# TODO: Fix this string!
ford_quote = "Whether you think you can, or you think you can't--you're right."

Solution: Write a Server Log Message

Here are a couple of options for this one:

print (username + " accessed the site " + url + " at " + timestamp + ".")

OR

message = username + " accessed the site " + url + " at " + timestamp + "."
print(message)

Solution: len()

name_length = len(given_name) + len(middle_names) + len(family_name) + 2